package com.huli.controller;

import com.huli.domain.OwnerIncome;

import com.huli.dto.GarageIncomeDto;
import com.huli.dto.OwnerIncomeDto;
import com.huli.dto.PlatformIncomeDto;
import com.huli.dto.PropertyCompanyDto;
import com.huli.param.OwnerIncomeParam;
import com.huli.param.PlatformIncomeParam;
import com.huli.param.PropertyCompanyParam;
import com.huli.service.OwnerIncomeService;
import com.huli.service.PlatformIncomeService;
import com.huli.service.PropertyCompanyService;
import com.huli.service.impl.OwnerIncomeServiceImpl;
import com.huli.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(tags = "收入服务")
@RestController
@RequestMapping("ownerIncome")

public class IncomeController {

    @Autowired
    OwnerIncomeService ownerIncomeService;
    @Autowired
    PlatformIncomeService platformIncomeService;
    @Autowired
    PropertyCompanyService propertyCompanyService;


    @ApiOperation("通过位主id查询位主 日收入")
    @ApiImplicitParam(name = "ownerId",value = "位主id" )
    @GetMapping("selectOwnerDayIncomeById")
    public Result selectOwnerDayIncomeById(int ownerId){
        List<OwnerIncome> ownerIncomes = ownerIncomeService.selectOwnerDayIncomeById(ownerId);
        return Result.successResult(ownerIncomes);
    }



    @ApiOperation("通过位主id查询位主 月收入")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "month",value = "月份"),
            @ApiImplicitParam(name = "ownerId",value = "位主id")
    })
    @GetMapping("selectOwnerMonthIncomeById")
    public  Result selectOwnerMonthIncomeById(OwnerIncomeParam ownerIncomeParam){
        OwnerIncomeDto ownerIncomeDto = ownerIncomeService.selectOwnerMonthIncomeById(ownerIncomeParam);
        return  Result.successResult(ownerIncomeDto);
    }




    @ApiOperation("查询平台日收入")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year",value = "年份"),
            @ApiImplicitParam(name = "month",value = "月份"),
            @ApiImplicitParam(name = "day",value = "日")
    })
    @GetMapping("selectPlatformIncome")
    public Result selectPlatformIncome(PlatformIncomeParam platformIncomeParam){
        PlatformIncomeDto platformIncomeDto = platformIncomeService.selectPlatformIncome(platformIncomeParam);
        return  Result.successResult(platformIncomeDto);
    }




    @ApiOperation("通过物业id 查询物业  日收入")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year",value = "年份"),
            @ApiImplicitParam(name = "month",value = "月份"),
            @ApiImplicitParam(name = "day",value = "日"),
            @ApiImplicitParam(name = "propertyCompanyId",value = "物业id")
    })
    @GetMapping("selectPropertyDayIncomeById")
    public Result selectPropertyDayIncomeById(PropertyCompanyParam propertyCompanyParam){
        PropertyCompanyDto propertyCompanyDto = propertyCompanyService.selectPropertyDayIncomeById(propertyCompanyParam);
        return  Result.successResult(propertyCompanyDto);
    }





    @ApiOperation("通过物业id 查询车库  日收入")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year",value = "年份"),
            @ApiImplicitParam(name = "month",value = "月份"),
            @ApiImplicitParam(name = "day",value = "日"),
            @ApiImplicitParam(name = "propertyCompanyId",value = "物业id")
    })
    @GetMapping("selectGarageDayIncomeById")
    public Result selectGarageDayIncomeById(PropertyCompanyParam propertyCompanyParam){
        List<GarageIncomeDto> garageIncomeDtos = propertyCompanyService.selectGarageDayIncomeById(propertyCompanyParam);
        return  Result.successResult(garageIncomeDtos);
    }
}